package com.quanshu.shop.goods.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quanshu.exchange.R;
import com.quanshu.exchange.support.config.Config;
import com.quanshu.shop.goods.entity.GoodsListEntity;

import java.util.List;

/**
 * 作者  李哲
 * 创建时间 2018/7/24
 * 邮箱 lizhetongliao@163.com
 * 说明
 **/
public class GoodsListAdapter extends BaseQuickAdapter<GoodsListEntity.DataEntity, BaseViewHolder> {
    private Context mContext;

    public GoodsListAdapter(List<GoodsListEntity.DataEntity> data, Context context1) {
        super(R.layout.item_goods_list, data);
        mContext = context1;
    }

    @Override
    protected void convert(BaseViewHolder helper, GoodsListEntity.DataEntity item) {
        Glide.with(mContext).load(Config.URL_HOST_SHOP + item.getImg()).into((ImageView) helper.getView(R.id.goods_list_img));
        helper.setText(R.id.goods_list_name, item.getName());
        helper.setText(R.id.goods_list_money, "¥ " + item.getSell_price());
        helper.addOnClickListener(R.id.goods_list_cl);
    }
}
